/*
 * @description: 
 * @Date: 2022-11-09 16:21:06
 * @LastEditTime: 2022-11-28 20:21:56
 */
function dataURLtoBlob(dataurl) {
  var arr = dataurl.split(','),
    mime = arr[0].match(/:(.*?);/)[1],
    bstr = atob(arr[1]),
    n = bstr.length,
    u8arr = new Uint8Array(n);
  while (n--) {
    u8arr[n] = bstr.charCodeAt(n);
  }
  return blobToFile(new Blob([u8arr], { type: mime }), 'logo.png');
}
//将blob转换为file
function blobToFile(theBlob, fileName) {
  theBlob.lastModifiedDate = new Date();
  theBlob.name = fileName;
  return theBlob;
}

export default dataURLtoBlob